# -*- encoding : utf-8 -*-
class CreateBookReserves < ActiveRecord::Migration
  def change
    create_table :book_reserves do |t|
      t.integer :user_id
      t.integer :book_id
      t.datetime :reserved_time
      
      t.timestamps
    end
    
    add_index :book_reserves, :user_id
    add_index :book_reserves, :book_id
    
    add_foreign_key(:book_reserves, :users, column: 'user_id')
    add_foreign_key(:book_reserves, :books, column: 'book_id')
  end
end
